package cn.wolfcode._IOday01_.synthesizeWork02;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Demo {
    public static void main(String[] args) throws IOException {
        File file = new File("666.txt");

        FileReader reader = new FileReader(file);

        char[] ch = new char[200];

        int i=reader.read(ch);
        String str = new String(ch,0,i);
        String[] split = str.split(";");//每个人的信息
        //接收对象
        Student[] student = new Student[split.length];
        int index = 0;

        for (int j = 0; j < split.length; j++) {
            //将每个的信息拆开
            String[] split1 = split[j].split("-");//学生对象的信息
            int i1 = Integer.valueOf(split1[1]);
            double aDouble = Double.valueOf(split1[2]);
            student[index] = new Student(split1[0],i1,aDouble);
            index++;
        }




        //遍历
        double sum = 0;
        for (Student student1 : student) {
            System.out.println("student1.toString() = " + student1.toString());
            sum += student1.getScore();
        }


        System.out.println("sum = " + sum);
    }
}
